Title: Analyzing The Relationship Between Cryptocurrencies and Inflation

Eshan Kaul

We have all heard the countless Bitcoin backers claiming that Bitcoin is a bullet-proof hedge against inflation and is the best way to protect long-term wealth, and recently many established financial institutions have also been hoping onto this bandwagon. Their argument is simple. Bitcoin, unlike normal fiat currencies, has a limited, predetermined supply of coins that can be entered into circulation. This means that governments or central banks can not devalue the currency by increasing the supply. This limited quantity attribute has resulted in many individual and institutional investors liking bitcoin to gold which used to be believed as a hedge against the dollar.

The goal of this project is to determine if there is any validity to the argument that cryptocurrencies can be used as a hedge against inflation. Are cryptocurrencies really a good method of protecting wealth from inflation and if so, do all cryptocurrencies work, or are specific currencies that work better than others. These questions are motivated by the larger questions of how does adjusting the money supply while maintaining the monetary base affects the greater economy, but for the purposes of this project, we will focus on tackling the more specific questions of what are the relationships between crypto and inflation?

To address this issue we would like to collect relevant data on historical and current inflation rates along with data on the price patterns of at least one type of fixed supply cryptocurrency and one type of cryptocurrency with a flexible supply.

The analysis will be broken down into two parts. The first part will compare the current/previous relationship between cryptocurrencies and inflation rates. The second part will then be to develop a model to estimate the future trends of cryptocurrencies and inflation rates to explore how the two might vary in the future.

Reading in Federal Reserve Data

The following data is retrieved from https://fred.stlouisfed.org/. This website is the online database for the Federal Reserve Economic Data and is used to gather the inflation data, along with any other relevant inflationary metrics. The data is downloaded directly from the FRED website in CSV format, and simple scripts are then run to convert the data to the correct types, and rename the variables/columns for readability.

Cleaning FRED Data

Reading in Crypto Data

The following data is on the relevant cryptocurrency metrics. These data sets are retrieved from Binance and Coinbase. The Coinbase data is retrieved using a method that is provided by the Coinbase API to retrieve .csv files of their daily data. The method works by passing in a string argument of the cryptocurrency that is being requested and returns the .csv file of the past year's work of data for the specified cryptocurrency. The data that was read in was already cleaned and well named and did not require any additional cleaning scripts to be used for later analysis and visualizations.

Exploratory Analysis

The following line graphs show the collected data to better understand the data.

It is interesting to note that although the real inflation rates seem to be slow-moving and take several years to change in value the public expectations of inflation rates are much more volatile, constantly changing, and often times much more extreme than the actual rates.

We see here that the closing price data for Bitcoin and Ethereum both seem to have similar movements throughout the year. This connection is worth exploring further with some more analysis.

Interpreting Cryptocurrency Price Relationship

This scatter plot further shows the relationship between the price of Bitcoin and Ethereum. There appears to be a small positive linear correlation between the price of the two cryptocurrencies. This correlation seems to be confirmed by the ordinary least squares regression line shown on the graph. This begs the question if Bitcoin and Ethereum are correlated are other cryptos also correlated. To further explore this a Pearson correlation can be used to measure the linear correlation between the different crypto currencies.

Analysis

To further explore the relationships between cryptocurrencies and inflation more data will be needed. The first step will then be to gather price data on more cryptocurrencies from the US Federal Reserve online database. This data will then need to be combined with the public's expectation of future inflation rates. The reason the expected inflation rates are used instead of the real inflation rates is that it is assumed that people will believe that crypto is an inflationary hedge and will make their movements based on their future expectations. This heat map shows the Pearson correlation between several different cryptocurrencies (Bitcoin, Ethereum, Litecoin, Bitcoin Cash) and the expected inflation rate.

As seen in the graph, there seems to be some correlation between the different cryptocurrencies, and all crypto except Bitcoin Cash seems to be positively correlated with the expected inflation rates. This on the surface seems to give some validity to the argument that people view cryptocurrencies as an inflationary hedge, as when the public's inflation expectations rise there is a noticeable rise in many crypto prices. This trend is especially noticeable in Bitcoin and Ethereum.

Modeling Relationship Between Crypto Price Movement and Expected Inflation Rates

Now that a relationship between crypto prices and expected inflation rates has been established, a deeper dive into the relationship can be performed through an Ordinary Least Squares regression (OLS). The OLS is a strong modeling tool that is often used in econometrics for forecasting future markets.

The purpose of the OLS is to take a theoretical equation: $Y_{i} = {\beta}_{0} + {\beta}_{1}X_{i} + {\beta}_{2}X_{i} + {\beta}_{3}X_{i} + {\beta}_{4}X_{i} + {\epsilon}$ (1.1)
to create the estimated equation: $\hat{Y_{i}} = \hat{\beta}_{0} + \hat{\beta}_{1}X_{i} + \hat{\beta}_{2}X_{i} + \hat{\beta}_{3}X_{i} + \hat{\beta}_{4}X_{i}$ (1.2)

This is achived by minimizing the sum of the squared residuals. In this regression model the expected inflation rate is endogenous, while the crypto prices are exogenous. The output of this model is shown below.

Results From Initial Regression Model

From the output, we are able to derive the following model to estimate the effect of the various cryptocurrencies on inflation expectations. The validity of each variable in the model in the model can be interpreted using the standard error and t value of each variable as shown in the output above. The high adjusted R-squared value also seems to suggest that the OLS might be a good fit for the data. Below we will also visualize the estimated model with the real data to do a visual comparison of the estimated expected inflation rates against the real expected inflation rates.

image-3.png

Yhat as shown in equation 1.2 represents the estimated expected inflation values based on the residuals from the OLS model.

Here we plot both the predicted and the actual inflation values to ensure that the predicted model is a good fit for the actual data.

Comparing the Model Data Against the Real Data

This graph shows how the change in expected inflation and cryptocurrencies' closing prices correlate. The graph seems to demonstrate that even slight increases in expected inflation correspond to result in a disproportionately large change in the prices of many cryptocurrencies.

Summary of initial analysis

From the initial exploratory visuals, it was clear that there were some interesting relationships between cryptocurrency prices and expected inflation rates. The OLS linear regression further supports this finding and suggests that the demand for cryptocurrencies increases when there are widespread public fears of rising inflation. More formally we can generalize the model of attractiveness of cryptocurrencies to investors as: $p^{{\beta}}_{i} = {\beta}_{0} + {\beta}_{1}{\alpha}_{i} + {\epsilon}_{i}$

ARIMA

Although the OLS model is a very powerful tool it is weakened when the model does not follow all seven classical assumptions. The time series model does not specifically address the autocorrelation problem which would likely violate the Gauss-Markov theorem for making the OLS the best unbiased linear estimator. To address this an autoregressive integrated moving average algorithm might be useful in developing an even stronger forecasting algorithm. This model is preferred in time series as it uses the previous values from the time series to predict the future values. In other words, ARIMA models use the lag from their own data and the lag from forecasted errors to predict future values.

The auto regressive (AR) part of the model can be described by the follwoing equation: $Y_{t} = {\alpha}+{\beta}_{1}Y_{t-1} + {\beta}_{2}Y_{t-2} + ... + {\beta}_{p}Y_{t-p} + {\epsilon}_{1}$ (2.1)

The moving average (MA) part of the model can be described by the follwoing equation: $Y_{t} = {\alpha} + {\epsilon}_{t} +{\phi}_{1}{\epsilon}_{t-1} + {\phi}_{2}{\epsilon}_{t-2} + ... + {\phi}_{q}{\epsilon}_{t-q}$ (2.2)

Combined this yeilds the (ARIMA) model: $Y_{t} = {\alpha}+{\beta}_{1}Y_{t-1} + {\beta}_{2}Y_{t-2} + ... + {\beta}_{p}Y_{t-p} + {\epsilon}_{1} + {\phi}_{1}{\epsilon}_{t-1} + {\phi}_{2}{\epsilon}_{t-2} + ... + {\phi}_{q}{\epsilon}_{t-q}$ (2.3)

There are 3 terms in the ARIMA model (p, d, q):

Stationary VS Non-Stationary

The first step is to calculate the number of differencing operations required to make the time series data stationary. This will be done using the Augmented Dicky Fuller Test(ADF).

Let $H_{0}: $ $d { \neq } 0$ in other words, the time series is non-stationary Then it follows that $H_{{\alpha}}: $ $d = 0$ in other words, the time series is stationary

This test will reject the null if p-value < 0.05 in which case there is no need to find an order of differencing. If the p-value is > 0.05 then we would fail to reject the null and the series will require differencing operations to be performed until the time series is stationary.

Interpreting ADF-Test Results

Note that the p-values for the first 3 cryptocurrencies are all very high, above 0.05. Additionally, the majority of the critical values are less than the values of their respective Augmented Dicky Fuller test statistic. As a result, we cannot reject the null hypothesis, which leaves us to conclude that the time series data is not stationary.

Intuitively, this makes sense in the context of cryptocurrencies prices and expected inflation rates. This is because changes in crypto prices and inflation expectations are generally speaking the result of mean independent increments that occur to daily economic shocks. These movements in prices depend on the previous price. One method of dealing with this issue is to model the returns of the crypto prices instead of the prices. While daily prices $X_{t}$ are generally non stationary while the daily returns $Y_{t} = \frac{X_{t} - X_{t-1}}{X_{t-1}}$ are generally stationary. To confirm the assumption that price movements are non-stationary we can look at the generalized daily price movements function. $X_{t} = X_{t-1} + {\epsilon}_{t} = X_{t-2} + {\epsilon}_{t-1} + {\epsilon}_{t} + X_{t-3} + {\epsilon}_{t-2} + {\epsilon}_{t} + ... + $ by repeated substitution yeilds: $\sum_{{\tau}=0}^{t} {\epsilon_{\tau}}$ which by definition is a linear stochastic process that has a unit root of 1 which describes a non stationary process. While taking the percent change is a good method to remove this effect another method is to take the log difference of the function. Applying the log difference to the function is useful as logarithms are time-invariant and will help to stabilize the variance. Taking the first order of difference of this function can be used to obtain the required stationary data.

Since the initial ordinary least squares regression model showed that Bitcoin and Ethereum are most likely to have a strong correlation with the expected inflation rates, we will focus our efforts on making those data sets stationery

Making Timeseries Data Stationary

D is the number of differences required to make the time series stationary. This will be done by ploting the Autocorrelation Function (ACF) and performing the order of difference operation on the data untill the data becomes stationary.

Interpreting the Bitcoin Timeseries Data

In the first plot, we can see that there is clear movement of the Bitcoin closing prices over time. Additionally, we see severe autocorrelation for the initial data. The second plot shows the first-order difference of the Bitcoin data. Here we can instantly see that the data is much more stationary than before and the autocorrelation is for the most part in an acceptable range. From these graphs, we can conclude that the value of d, the order of differences required to make the time series stationary in the ARIMA model, is 1 for the first-order difference of the Bitcoin data.

Interpreting the Timeseries Ethereum Data

In the first plot, we can see that the Ethereum closing prices are clearly moving in an upwards direction over time and is thus non-stationary. Additionally, we see severe autocorrelation for the initial data. The second plot shows the first-order difference of the Ethereum data. Here the data is much more stationary than before and the autocorrelation is less severe. The third plot shows the second-order difference for the Ethereum data. When compared with the first-order difference we see that the first-order difference is a better fit. From these graphs, we can conclude that the value of d should be 1 for the first-order difference of the Ethereum data.

Determining P (Auto Regressive Term)

P is the number of lags to be used in the ARIMA model. This can be determined by creating a Partial Autocorrelation Plot (PACF Plot). Here the partial autocorrelation represents the correlation between the time-series data and its lags.

Interperting Autoregressive Term

From both PACF plots it is clear that the first term in the data that displays significant lag is point 6. Thus the q value for the AMIRA model for both Bitcoin and Ethereum is 6.

Determining Q (Moving Average Term)

Q is the order of the moving average term to be used in the ARIMA model. This refers to the number of lagged forecast errors that should be taken into account in the model. The ACF plot will show the number of lags to consider.

Interperting Moving Average Term

From the plots above, we can determine that number of lagged forecast errors for Bitcoin is 4 and the number of errors for Ethereum is 3.

Fitting the ARIMA Model For Bitcoin and Ethereum

Bitcoin ARIMA Price Forecast

The model above shows the results from the ARIMA model on the Bitcoin data. The plots below show that the data is indeed stationary, and the data is distributed around the mean which confirms the stationary nature of the data.

Plot Bitcoin Price Forcast

Based on the results from the Bitcoin ARIMA model we can now plot the forecasted model against the actual closing price movements. The ARIMA model shows a much greater fit then the original OLS model that was used before.

Ethereum ARIMA Price Forecast

Plot Ethereum Price Forcast

Based on the results from the Ethereum ARIMA model we can now plot the forecasted model against the actual closing price movements. From this visual, we can observe that the ARIMA model is a good fit for the real Ethereum data over this time period. This type of model might be useful to crypto investors in making their predictions on how the price of the cryptocurrency will move over time to optimize their strategy.

To predict the next n samples of Ethereum prices we can use the .forcast(steps = n) method which will return an array of the next n predictions of Ethereum closing prices based off the ARIMA model.

Summary of Project Results

The goal of the project was to determine if there was any validity to the argument that cryptocurrency prices are correlated with inflation rates. To establish if there was a relationship between cryptocurrency prices and expected inflation rates a Pearson correlation and an Ordinary Least Squares regression were performed on expected inflation rates and the closing prices of four different cryptocurrency prices. The results from the initial analysis seem to confirm that a linear relationship between the prices of cryptocurrencies and inflation rates is positively correlated. In other words, as the prices of cryptocurrencies increase the models suggest that the public's expected inflation rate also increases. After discovering this relationship, the next objective of the project was to determine if there was any useful method of determining if an investor could determine the future prices of various cryptocurrencies. There are many issues with attempting to predict future prices in a time-series model. These issues are addressed by using an autoregressive moving average that will make the time-series data stationary and use the model's estimated forecast errors to improve the model. This model was done on Bitcoin and Ethereum data to determine if investors could generate some level of alpha, some statistical edge, to predict the future prices of these two cryptocurrencies. The results from these tests suggest that the generated model is a good fit for the current data and is likely useful for investors to be used in their analysis when attempting to determine how to hedge their investments regarding cryptocurrencies.

https://quant.stackexchange.com/questions/16481/why-do-we-usually-model-returns-and-not-prices https://quant.stackexchange.com/questions/4160/discrete-returns-versus-log-returns-of-assets https://www.emerald.com/insight/content/doi/10.1108/SEF-09-2012-0106/full/html https://stats.stackexchange.com/questions/465514/why-prices-are-usually-not-stationary-but-returns-are-more-likely-to-be-station https://en.wikipedia.org/wiki/Unit_root https://otexts.com/fpp2/stationarity.html https://blog.quantinsti.com/stationarity/ https://link.springer.com/article/10.1007/s00521-020-05129-6 https://www.semanticscholar.org/paper/Time-series-forecast-in-non-stationary-environment-Garbacz/f79fb84f5001dafe120c68ae7379f92907566511 https://www.semanticscholar.org/paper/Time-series-forecast-in-non-stationary-environment-Garbacz/f79fb84f5001dafe120c68ae7379f92907566511

https://en.wikipedia.org/wiki/Augmented_Dickey%E2%80%93Fuller_test https://en.wikipedia.org/wiki/Pearson_correlation_coefficient https://en.wikipedia.org/wiki/Ordinary_least_squares https://en.wikipedia.org/wiki/Autoregressive_integrated_moving_average